<?php defined('SYSPATH') or die('No direct script access.');
require_once MODPATH.'swift/swift_required.php';

class SwiftWrapper
{
  public static function &factory($transport_type = 'mail')
  {
    $retval['message'] = Swift_Message::newInstance();
    switch (strtolower($transport_type)){
      case 'smtp':
        $retval['transport'] = Swift_SmtpTransport::newInstance();
        break;
      case 'sendmail':
        $retval['transport'] = Swift_SendmailTransport::newInstance();
        break;
      default:
        $retval['transport'] = Swift_MailTransport::newInstance();
    }
    $retval['mailer'] = Swift_Mailer::newInstance($retval['transport']);
    
    return $retval;
  }
}